Generation of automated unit tests for a controller layer system and method

ABSTRACT

A method, computer program product, and computer system for receiving, by a computing device, a selection of one or more files for which to have one or more automated unit tests generated for an application under test. An action in the application under test is received while the application under test is used. Behavior data of how the application under test responds to the action is tracked. An automated unit test of the one or more automated unit tests is generated for underlying code of the application under test invoked when receiving the action based upon, at least in part, the behavior data of how the application under test responds to the action.

RELATED APPLICATIONS

The subject application is a continuation application of U.S. patentapplication Ser. No. 14/454,236, filed on Aug. 7, 2014, the entirecontent of which is herein incorporated by reference.

BACKGROUND

A common design pattern for developing software applications may includethe “model, view, controller” pattern. For example, the model mayinclude the data, the view may include how the user interacts with thesoftware application, and the controller may include the middle logic orservice layer that the view may call to interact with the model. Users(e.g., software developers) working on a software application using theabove-noted model, view, controller pattern may be unaware if they makea change to the controller how it may affect various pieces of the view.Unit tests may be created to ensure that code in the controller layercontinues to behave correctly.

BRIEF SUMMARY OF DISCLOSURE

In one implementation, a method, performed by one or more computingdevices, may include but is not limited to receiving, by a computingdevice, a selection of one or more files for which to have one or moreautomated unit tests generated for an application under test. An actionin the application under test may be received while the applicationunder test is used. Behavior data of how the application under testresponds to the action may be tracked. An automated unit test of the oneor more automated unit tests may be generated for underlying code of theapplication under test invoked when receiving the action based upon, atleast in part, the behavior data of how the application under testresponds to the action.

One or more of the following features may be included. It may bedetermined that the behavior data of how the application under testresponds is unexpected and at least a portion of the behavior data maybe removed in response to determining that the behavior data of how theapplication under test responds is unexpected. It may be determined thatthe behavior data of how the application under test responds is asexpected, wherein the automated unit test for the underlying code of theapplication under test invoked may be generated based upon determiningthat the behavior data of how the application under test responds is asexpected. The behavior data of how the application under test respondsmay include at least one method called in response to receiving theaction in the application under test. The behavior data of how theapplication under test responds may include at least one of a value andan object passed into the at least one method called in response toreceiving the action in the application under test. The behavior data ofhow the application under test responds may include at least one of avalue and an object returned by the at least one method called inresponse to receiving the action in the application under test. Theautomated unit test may call the at least one method using identicalparameters used in response to receiving the action in the applicationunder test.

In another implementation, a computing system includes a processor and amemory configured to perform operations that may include but are notlimited to receiving a selection of one or more files for which to haveone or more automated unit tests generated for an application undertest. An action in the application under test may be received while theapplication under test is used. Behavior data of how the applicationunder test responds to the action may be tracked. An automated unit testof the one or more automated unit tests may be generated for underlyingcode of the application under test invoked when receiving the actionbased upon, at least in part, the behavior data of how the applicationunder test responds to the action.

One or more of the following features may be included. It may bedetermined that the behavior data of how the application under testresponds is unexpected and at least a portion of the behavior data maybe removed in response to determining that the behavior data of how theapplication under test responds is unexpected. It may be determined thatthe behavior data of how the application under test responds is asexpected, wherein the automated unit test for the underlying code of theapplication under test invoked may be generated based upon determiningthat the behavior data of how the application under test responds is asexpected. The behavior data of how the application under test respondsmay include at least one method called in response to receiving theaction in the application under test. The behavior data of how theapplication under test responds may include at least one of a value andan object passed into the at least one method called in response toreceiving the action in the application under test. The behavior data ofhow the application under test responds may include at least one of avalue and an object returned by the at least one method called inresponse to receiving the action in the application under test. Theautomated unit test may call the at least one method using identicalparameters used in response to receiving the action in the applicationunder test.

In another implementation, a computer program product resides on acomputer readable storage medium that has a plurality of instructionsstored on it. When executed by a processor, the instructions cause theprocessor to perform operations that may include but are not limited toreceiving a selection of one or more files for which to have one or moreautomated unit tests generated for an application under test. An actionin the application under test may be received while the applicationunder test is used. Behavior data of how the application under testresponds to the action may be tracked. An automated unit test of the oneor more automated unit tests may be generated for underlying code of theapplication under test invoked when receiving the action based upon, atleast in part, the behavior data of how the application under testresponds to the action.

One or more of the following features may be included. It may bedetermined that the behavior data of how the application under testresponds is unexpected and at least a portion of the behavior data maybe removed in response to determining that the behavior data of how theapplication under test responds is unexpected. It may be determined thatthe behavior data of how the application under test responds is asexpected, wherein the automated unit test for the underlying code of theapplication under test invoked may be generated based upon determiningthat the behavior data of how the application under test responds is asexpected. The behavior data of how the application under test respondsmay include at least one method called in response to receiving theaction in the application under test. The behavior data of how theapplication under test responds may include at least one of a value andan object passed into the at least one method called in response toreceiving the action in the application under test. The behavior data ofhow the application under test responds may include at least one of avalue and an object returned by the at least one method called inresponse to receiving the action in the application under test. Theautomated unit test may call the at least one method using identicalparameters used in response to receiving the action in the applicationunder test.

The details of one or more implementations are set forth in theaccompanying drawings and the description below. Other features andadvantages will become apparent from the description, the drawings, andthe claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an illustrative diagrammatic view of a generation processcoupled to a distributed computing network according to one or moreimplementations of the present disclosure;

FIG. 2 is a diagrammatic view of a client electronic device of FIG. 1according to one or more implementations of the present disclosure;

FIG. 3 is an illustrative flowchart of the generation process of FIG. 1according to one or more implementations of the present disclosure;

FIG. 4 is an illustrative diagrammatic view of a screen image displayedby the generation process of FIG. 1 according to one or moreimplementations of the present disclosure;

FIG. 5 is an illustrative example file that may be used by thegeneration process of FIG. 1 according to one or more implementations ofthe present disclosure;

FIG. 6 is an illustrative behavior data example that may be used by thegeneration process of FIG. 1 according to one or more implementations ofthe present disclosure; and

FIG. 7 is an illustrative automated unit test example that may be usedby the generation process of FIG. 1 according to one or moreimplementations of the present disclosure.

Like reference symbols in the various drawings indicate like elements.

DETAILED DESCRIPTION

System Overview:

As will be appreciated by one skilled in the art, aspects of the presentdisclosure may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present disclosure may take theform of an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present disclosure may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent disclosure may be written in any combination of one or moreprogramming languages, including an aspect oriented programminglanguage, an object oriented programming language such as Smalltalk, C++or the like and conventional procedural programming languages, such asthe “C” programming language or similar programming languages. Theprogram code may execute entirely on the user's computer, partly on theuser's computer, as a stand-alone software package, partly on the user'scomputer and partly on a remote computer or entirely on the remotecomputer or server. In the latter scenario, the remote computer may beconnected to the user's computer through any type of network, includinga local area network (LAN) or a wide area network (WAN), or theconnection may be made to an external computer (for example, through theInternet using an Internet Service Provider).

Aspects of the present disclosure are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of thedisclosure. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present disclosure. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

Referring now to FIG. 1, there is shown generation process 10 that mayreside on and may be executed by a computer (e.g., computer 12), whichmay be connected to a network (e.g., network 14) (e.g., the internet ora local area network). Examples of computer 12 (and/or one or more ofthe client electronic devices noted below) may include, but are notlimited to, a personal computer(s), a laptop computer(s), mobilecomputing device(s), a server computer, a series of server computers, amainframe computer(s), or a computing cloud(s). Computer 12 may executean operating system, for example, but not limited to, Microsoft®Windows®; Mac® OS X®; Red Hat® Linux®, or a custom operating system.(Microsoft and Windows are registered trademarks of MicrosoftCorporation in the United States, other countries or both; Mac and OS Xare registered trademarks of Apple Inc. in the United States, othercountries or both; Red Hat is a registered trademark of Red HatCorporation in the United States, other countries or both; and Linux isa registered trademark of Linus Torvalds in the United States, othercountries or both).

As will be discussed below in greater detail, generation process 10 mayreceive, by a computing device, a selection of one or more files forwhich to have one or more automated unit tests generated for anapplication under test. An action in the application under test may bereceived while the application under test is used. Behavior data of howthe application under test responds to the action may be tracked. Anautomated unit test of the one or more automated unit tests may begenerated for underlying code of the application under test invoked whenreceiving the action based upon, at least in part, the behavior data ofhow the application under test responds to the action.

The instruction sets and subroutines of generation process 10, which maybe stored on storage device 16 coupled to computer 12, may be executedby one or more processors (not shown) and one or more memoryarchitectures (not shown) included within computer 12. Storage device 16may include but is not limited to: a hard disk drive; a flash drive, atape drive; an optical drive; a RAID array; a random access memory(RAM); and a read-only memory (ROM).

Network 14 may be connected to one or more secondary networks (e.g.,network 18), examples of which may include but are not limited to: alocal area network; a wide area network; or an intranet, for example.

Computer 12 may include a data store, such as a database (e.g.,relational database, object-oriented database, triplestore database,etc.) and may be located within any suitable memory location, such asstorage device 16 coupled to computer 12. Any data described throughoutthe present disclosure may be stored in the data store. In someimplementations, computer 12 may utilize a database management systemsuch as, but not limited to, “My Structured Query Language” (MySQL®) inorder to provide multi-user access to one or more databases, such as theabove noted relational database. The data store may also be a customdatabase, such as, for example, a flat file database or an XML database.Any other form(s) of a data storage structure and/or organization mayalso be used. Generation process 10 may be a component of the datastore, a stand alone application that interfaces with the above noteddata store and/or an applet/application that is accessed via clientapplications 22, 24, 26, 28. The above noted data store may be, in wholeor in part, distributed in a cloud computing topology. In this way,computer 12 and storage device 16 may refer to multiple devices, whichmay also be distributed throughout the network.

Computer 12 may execute an application under test (AUT) (e.g., AUT 20),examples of which may include, but are not limited to, e.g., a webconferencing application, a video conferencing application, avoice-over-IP application, a video-over-IP application, InstantMessaging (IM)/“chat” application, or other application that mayinteract with a software development application. Generation process 10and/or AUT 20 may be accessed via client applications 22, 24, 26, 28.Generation process 10 may be a stand alone application, or may be anapplet/application/script/extension that may interact with and/or beexecuted within AUT 20, a component of AUT 20, and/or one or more ofclient applications 22, 24, 26, 28. AUT 20 may be a stand aloneapplication, or may be an applet/application/script/extension that mayinteract with and/or be executed within generation process 10, acomponent of generation process 10, and/or one or more of clientapplications 22, 24, 26, 28. One or more of client applications 22, 24,26, 28 may be a stand alone application, or may be anapplet/application/script/extension that may interact with and/or beexecuted within and/or be a component of generation process 10 and/orAUT 20. Examples of client applications 22, 24, 26, 28 may include, butare not limited to, e.g., a web conferencing application, a videoconferencing application, a voice-over-IP application, a video-over-IPapplication, Instant Messaging (IM)/“chat” application, or otherapplication that may interact with a software development application, asoftware development application, a standard and/or mobile web browser,an email client application, a textual and/or a graphical userinterface, a customized web browser, a plugin, an ApplicationProgramming Interface (API), or a custom application. The instructionsets and subroutines of client applications 22, 24, 26, 28, which may bestored on storage devices 30, 32, 34, 36, coupled to client electronicdevices 38, 40, 42, 44, may be executed by one or more processors (notshown) and one or more memory architectures (not shown) incorporatedinto client electronic devices 38, 40, 42, 44.

Storage devices 30, 32, 34, 36, may include but are not limited to: harddisk drives; flash drives, tape drives; optical drives; RAID arrays;random access memories (RAM); and read-only memories (ROM). Examples ofclient electronic devices 38, 40, 42, 44 (and/or computer 12) mayinclude, but are not limited to, a personal computer (e.g., clientelectronic device 38), a laptop computer (e.g., client electronic device40), a smart/data-enabled, cellular phone (e.g., client electronicdevice 42), a notebook computer (e.g., client electronic device 44), atablet (not shown), a server (not shown), a television (not shown), asmart television (not shown), a media (e.g., video, photo, etc.)capturing device (not shown), and a dedicated network device (notshown). Client electronic devices 38, 40, 42, 44 may each execute anoperating system, examples of which may include but are not limited to,Android™, Apple® iOS®, Mac® OS X®; Red Hat® Linux®, or a customoperating system.

One or more of client applications 22, 24, 26, 28 may be configured toeffectuate some or all of the functionality of generation process 10(and vice versa). Accordingly, generation process 10 may be a purelyserver-side application, a purely client-side application, or a hybridserver-side/client-side application that is cooperatively executed byone or more of client applications 22, 24, 26, 28 and/or generationprocess 10.

One or more of client applications 22, 24, 26, 28 may be configured toeffectuate some or all of the functionality of AUT 20 (and vice versa).Accordingly, AUT 20 may be a purely server-side application, a purelyclient-side application, or a hybrid server-side/client-side applicationthat is cooperatively executed by one or more of client applications 22,24, 26, 28 and/or AUT 20. As one or more of client applications 22, 24,26, 28, generation process 10, and AUT 20, taken singly or in anycombination, may effectuate some or all of the same functionality, anydescription of effectuating such functionality via one or more of clientapplications 22, 24, 26, 28, generation process 10, AUT 20, orcombination thereof, and any described interaction(s) between one ormore of client applications 22, 24, 26, 28, generation process 10, AUT20, or combination thereof to effectuate such functionality, should betaken as an example only and not to limit the scope of the disclosure.

Users 46, 48, 50, 52 may access computer 12 and generation process 10(e.g., using one or more of client electronic devices 38, 40, 42, 44)directly through network 14 or through secondary network 18. Further,computer 12 may be connected to network 14 through secondary network 18,as illustrated with phantom link line 54. Generation process 10 mayinclude one or more user interfaces, such as browsers and textual orgraphical user interfaces, through which users 46, 48, 50, 52 may accessgeneration process 10.

The various client electronic devices may be directly or indirectlycoupled to network 14 (or network 18). For example, client electronicdevice 38 is shown directly coupled to network 14 via a hardwirednetwork connection. Further, client electronic device 44 is showndirectly coupled to network 18 via a hardwired network connection.Client electronic device 40 is shown wirelessly coupled to network 14via wireless communication channel 56 established between clientelectronic device 40 and wireless access point (i.e., WAP) 58, which isshown directly coupled to network 14. WAP 58 may be, for example, anIEEE 802.11a, 802.11b, 802.11g, Wi-Fi®, and/or Bluetooth™ device that iscapable of establishing wireless communication channel 56 between clientelectronic device 40 and WAP 58. Client electronic device 42 is shownwirelessly coupled to network 14 via wireless communication channel 60established between client electronic device 42 and cellularnetwork/bridge 62, which is shown directly coupled to network 14.

Some or all of the IEEE 802.11x specifications may use Ethernet protocoland carrier sense multiple access with collision avoidance (i.e.,CSMA/CA) for path sharing. The various 802.11x specifications may usephase-shift keying (i.e., PSK) modulation or complementary code keying(i.e., CCK) modulation, for example. Bluetooth™ is a telecommunicationsindustry specification that allows, e.g., mobile phones, computers,smart phones, and other electronic devices to be interconnected using ashort-range wireless connection. Other forms of interconnection (e.g.,Near Field Communication (NFC)) may also be used.

Referring also to FIG. 2, there is shown a diagrammatic view of clientelectronic device 38. While client electronic device 38 is shown in thisfigure, this is for illustrative purposes only and is not intended to bea limitation of this disclosure, as other configurations are possible.For example, any computing device capable of executing, in whole or inpart, generation process 10 may be substituted for client electronicdevice 38 within FIG. 2, examples of which may include but are notlimited to computer 12 and/or client electronic devices 40, 42, 44.

Client electronic device 38 may include a processor and/ormicroprocessor (e.g., microprocessor 200) configured to, e.g., processdata and execute the above-noted code/instruction sets and subroutines.Microprocessor 200 may be coupled via a storage adaptor (not shown) tothe above-noted storage device(s) (e.g., storage device 30). An I/Ocontroller (e.g., I/O controller 202) may be configured to couplemicroprocessor 200 with various devices, such as keyboard 206,pointing/selecting device (e.g., mouse 208), custom device (e.g., device215), USB ports (not shown), and printer ports (not shown). A displayadaptor (e.g., display adaptor 210) may be configured to couple display212 (e.g., CRT or LCD monitor(s)) with microprocessor 200, while networkcontroller/adaptor 214 (e.g., an Ethernet adaptor) may be configured tocouple microprocessor 200 to the above-noted network 14 (e.g., theInternet or a local area network).

The Generation Process:

As discussed above and referring also at least to FIGS. 3-7, generationprocess 10 may receive 300, by a computing device, a selection of one ormore files for which to have one or more automated unit tests generatedfor an application under test. Generation process 10 may receive 302 anaction in the application under test while the application under test isused. Behavior data of how the application under test responds to theaction may be tracked 304 by generation process 10. Generation process10 may generate 306 an automated unit test of the one or more automatedunit tests for underlying code of the application under test invokedwhen receiving 302 the action based upon, at least in part, the behaviordata of how the application under test responds to the action.

As noted above, a common design pattern for developing softwareapplications may include the “model, view, controller” pattern. Forexample, the model may include the data, the view may include how theuser interacts with the software application, and the controller mayinclude the middle logic or service layer that the view may call tointeract with the model. Users (e.g., software developers) working on asoftware application using the above-noted model, view, controllerpattern may be unaware if they make a change to the controller how itmay affect various pieces of the view.

Automated unit tests may be created to ensure that code in thecontroller layer continues to behave correctly. However, for a largecode base that may not have any existing automated unit tests, thesoftware developers may feel uncertain if the changes being made to thecontroller layer will break pieces of the view, and creating a solidunit test case suite from scratch may be onerous. Since view testautomation may be brittle, creating test automation for the controllerlayer may be a more valuable investment. For instance, assume forexample purposes only that a software developer (e.g., user 46) recentlyjoined the APPLICATION EXAMPLE team for AUT 20. The AUT 20 code basemay, e.g., be very large, have no automated testing, and/or use themodel, view, controller design pattern. It may take user 46 months tolearn and become completely comfortable with the code base, and, eventhen, user 46 may make a change to the controller layer and overlook away that one piece of the view was expecting the controller to behave.In this example, user 46 may break functionality in the view andintroduce defects into AUT 20.

Thus, in some implementations, generation process 10 may automaticallygenerate automated unit tests for, e.g., the controller layer byinvoking the view layer. As opposed to generating automated unit testsby performing static analysis of the code base and how to record testsof the higher-level view layer, generation process 10 may generateautomated unit tests for the underlying code that is actually beinginvoked when AUT 20 is in use.

For example, in some implementations, generation process 10 may receive300, by a computing device, a selection of one or more files for whichto have one or more automated unit tests generated for an applicationunder test. For instance, generation process 10 may include a userinterface, such as the example and non-limiting user interface 400 shownin FIG. 4. In the example, user interface 400 may include a code editor(not shown) and other functionality similarly known to those skilled inthe art for developing software applications, such as example AUT 20.Further in the example, generation process 10 may receive 300 (e.g., viauser cursor 402) a selection of the files (e.g., via object 404) forwhich generation process 10 is to have automated unit tests generated(e.g., files that may be part of the controller portion of AUT 20 thatindicate generation process 10 should track 304 those files to generate306 automated unit tests). An example of a file (e.g., UserProfile.java)may include an example method (e.g., method 500) like that shown in FIG.5.

Further assume in the example that generation process 10 receives (e.g.,via user cursor 402) a user input to launch AUT 20 (e.g., via object406). Further assume in the example that generation process 10 receives(e.g., via user cursor 402) a user input for generation process 10 tobegin tracking behavior data of AUT 20 (e.g., via object 408).

In some implementations, generation process 10 may receive 302 an actionin the application under test while the application under test is used.For instance, assume for example purposes only that as user 46 uses AUT20, user 46 uses cursor 402 to, e.g., click an option or type somethinginto a dialogue box (not shown). For example, and referring now at leastto example FIG. 6, user 46 (via generation process 10) may receive 302an action to access, e.g., BestUserEver's profile page in AUT 20, andthe user's name (e.g., Jane Jones) may be displayed on the page of AUT20. Generation process 10 may track 304 information (e.g., behaviordata) about the code that was called to access BestUserEver's profilepage in AUT 20 and may store the example behavior data (e.g., behaviordata 600) shown in FIG. 6.

In some implementations, as noted above, behavior data of how theapplication under test responds to the action may be tracked 304 bygeneration process 10. For instance, the behavior data of how AUT 20responds may include at least one method called in response to receiving302 the action in AUT 20 (e.g., what methods (or functions) in the codefor AUT 20 are called in response to the above-noted received 302action). As another example, the behavior data of how AUT 20 respondsmay include at least one of a value and an object passed into the atleast one method called in response to receiving 302 the action in AUT20. As yet another example, the behavior data of how AUT 20 responds mayinclude at least one of a value and an object returned by the at leastone method called in response to receiving 302 the action in AUT 20. Insome implementations, aspect oriented programming methods may be used bygeneration process 10 to insert observer code to track 304 each method'sinteraction with its own object and objects that are passed to it.

In some implementations, generation process 10 may generate 306 anautomated unit test of the one or more automated unit tests forunderlying code of AUT 20 invoked when receiving 302 the action basedupon, at least in part, the behavior data of how the application undertest responds to the action. For example, generation process 10 maydetermine 308 that the behavior data of how AUT 20 responds is asexpected, wherein the automated unit test for the underlying code of AUT20 invoked may be generated 306 based upon determining 308 that thebehavior data of how the application under test responds is as expected.For instance, assume for example purposes only that user 46 believesthat AUT 20 behaved as expected. In the example, generation process 10may receive (e.g., via user cursor 402) a user input to indicate thatuser 46 believes that AUT 20 behaved as expected (e.g., via object 408).For example, if AUT 20 behaved as expected, generation process 10 maygenerate 306 automated unit tests that duplicate the above-notedinformation (i.e., behavior data) that was tracked 304, like the exampleautomated unit test (e.g., automated unit test 700) shown at FIG. 7.

In the example, user 46 (via generation process 10) may now runautomated unit tests, such as automated unit test 700, that weregenerated 306 whenever user 46 makes changes to the code base of AUT 20.Because the automated unit tests are testing code that is lower than thefrequently changing and commonly brittle view, the automated unit testsmay be more stable. Once user 46 (via generation process 10) hasgenerated 306 automated unit tests for the common functions in the view,changes made to the controller are not likely to introduce defects inthe view in those areas. In some implementations, user 46 (viageneration process 10) may run these automated unit tests at any time tocheck for regressions. In some implementations, generation process 10may remove any duplicate automated unit tests.

In some implementations, the automated unit test may call the at leastone method using identical parameters used in response to receiving 302the action in AUT 20. For example, generation process 10 may generate306 an automated unit test for every time a method was called inresponse to receiving 302 the action in AUT 20. The automated unit test(via generation process 10) may call the function using the sameparameters that were used when user 46 took the action that was received302. The automated unit test (via generation process 10) may verify thatthe return value is the same value that was returned when user 46 tookthe action that was received 302. The automated unit test (viageneration process 10) may also make assertions about the method'sinteractions with the objects that were passed as parameters or thestate of the object that the method operates on.

In some implementations, generation process 10 may determine 310 thatthe behavior data of how the application under test responds isunexpected and at least a portion of the behavior data may be removed312 by generation process 10 in response to determining 310 that thebehavior data of how the application under test responds is unexpected.For instance, assume for example purposes only that user 46 believesthat AUT 20 did not behave as expected (e.g., the return value is notthe same value that was returned when user 46 took the action that wasreceived 302). In the example, generation process 10 may receive (e.g.,via user cursor 402) a user input to indicate that user 46 believes thatAUT 20 did not behave as expected (e.g., via object 412). In someimplementations, if AUT 20 did not behave as expected, generationprocess 10 may remove the behavior data tracked 304.

In some implementations, generation process 10 may track 304 the runtimedata over time by observing an actively used test system (e.g.,generation process 10). For example, statistical analysis may then beperformed on the data collected over time to generate 306 useful typicaland edge cases. For instance, if a method accepts a string, the datacollected over time may allow user 46 to understand what is the lengthof a typical string, as well as what may be the extreme cases for whichmay need to be tested.

While one or more implementations may include user action (e.g., viacursor 402 and user interface 400), it will be appreciated that any ofthe user action may be automated by generation process 10. For example,determining 308 that the behavior data of how the application under testresponds may be accomplished automatically by generation process 10,rather than requiring an input from user 46 as described above. Asanother example, the behavior data may be tracked 304 automatically atany point (e.g., while the application under test is being executed)rather than requiring an input from user 46 as described above. As such,any description of using a user's input should be taken as an exampleonly and not to limit the scope of the disclosure.

The terminology used herein is for the purpose of describing particularimplementations only and is not intended to be limiting of thedisclosure. As used herein, the singular forms “a”, “an” and “the” areintended to include the plural forms as well, unless the context clearlyindicates otherwise. It will be further understood that the terms“comprises” and/or “comprising,” when used in this specification,specify the presence of stated features, integers, steps (notnecessarily in a particular order), operations, elements, and/orcomponents, but do not preclude the presence or addition of one or moreother features, integers, steps (not necessarily in a particular order),operations, elements, components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present disclosure has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the disclosure in the form disclosed. Many modifications,variations, and any combinations thereof will be apparent to those ofordinary skill in the art without departing from the scope and spirit ofthe disclosure. The implementation(s) were chosen and described in orderto best explain the principles of the disclosure and the practicalapplication, and to enable others of ordinary skill in the art tounderstand the disclosure for various implementation(s) with variousmodifications and/or any combinations of implementation(s) as are suitedto the particular use contemplated.

Having thus described the disclosure of the present application indetail and by reference to implementation(s) thereof, it will beapparent that modifications, variations, and any combinations ofimplementation(s) (including any modifications, variations, andcombinations thereof) are possible without departing from the scope ofthe disclosure defined in the appended claims.

What is claimed is:
 1. A computer-implemented method comprising:Receiving, by a computing device, a selection of one or more files forwhich to have one or more automated unit tests generated for anapplication under test; receiving an action in the application undertest while the application under test is used; tracking behavior data ofhow the application under test responds to the action wherein trackingis performed by inserting observer code using aspect orientedprogramming method, which tracks each method's interaction with its ownobjects and objects that are passed to it; determining that the behaviordata of how the application under test responds is unexpected, andremoving at least a portion of the behavior data and generating anautomated unit test of the one or more automated unit tests forunderlying code of the application under test invoked when receiving theaction based upon, at least in part, the behavior data of how theapplication under test responds to the action.
 2. Thecomputer-implemented method of claim 1 further comprising: determiningthat the behavior data of how the application under test responds is asexpected, wherein the automated unit test for the underlying code of theapplication under test invoked is generated based upon determining thatthe behavior data of how the application under test responds is asexpected.
 3. The computer-implemented method of claim 1 wherein thebehavior data of how the application under test responds includes atleast one method called in response to receiving the action in theapplication under test.
 4. The computer-implemented method of claim 3wherein the behavior data of how the application under test respondsincludes at least one of a value and an object passed into the at leastone method called in response to receiving the action in the applicationunder test.
 5. The computer-implemented method of claim 3 wherein thebehavior data of how the application under test responds includes atleast one of a value and an object returned by the at least one methodcalled in response to receiving the action in the application undertest.
 6. The computer-implemented method of claim 3 wherein theautomated unit test calls the at least one method using identicalparameters used in response to receiving the action in the applicationunder test.